package com.godyao.mall.rabbitmq.starter.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;


/**
 * @author godyao
 * @date 2022/3/31
 */
@Configuration
@ComponentScan(basePackages = "com.godyao.mall.rabbitmq.service")
@EntityScan(basePackages = "com.godyao.mall.rabbitmq.model")
@EnableJpaRepositories(basePackages = "com.godyao.mall.rabbitmq.repository")
public class MyRabbitMqAutoConfiguration {
    @Bean
    public MessageConverter jsonMessageConverter(ObjectMapper objectMapper) {
        return new Jackson2JsonMessageConverter(objectMapper);
    }
}
